<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<base href="<%=request.getContextPath()%>/" />
    <link rel="stylesheet" type="text/css" href="Styles/admin-all.css" />
    <link rel="stylesheet" type="text/css" href="Styles/base.css" />
    <link rel="stylesheet" type="text/css" href="Styles/bootstrap.min.css" />
    <script type="text/javascript" src="ckeditor/ckeditor.js"></script>
    <script type="text/javascript" src="js/jquery-2.1.1.js"></script>
<title>后台管理系统</title>
</head>
<body>
  <caption>审批公文</caption>
  <div style="height:50px;width:none;">
  </div>
<table class="table table-hover">
   <input style="display:none;" class="form-control" id="gongwenid" value="${shenhe.gwId}">
  <div class="form-group">
  <div>
    <p class="text-center">${shenhe.title}</p></div>
    ${shenhe.content}
    <br/>
    <a href="download?filename=${shenhe.gwAddress}">下载附件</a><c:if test="${shenhe.gwAddress==null}">->无附件</c:if>
    </div>
    <c:forEach items="${person}" var="pn">
    审核人 ${pn.person} 意见:
    <c:if test="${pn.apAgree==0}" >不通过</c:if>
    <c:if test="${pn.apAgree==1}" >通过</c:if>
    ${pn.opinion}
    </c:forEach>
    <form id="form" role="form">
    <div class="form-group">
    <label for="name">通过与否</label>
     <input type="checkbox" name="box" id="box1" value=0 />公文审核不通过
     <input type="checkbox" name="box" id="box1" value=1 />公文审核通过
    <br/>
    <label for="name">审核意见</label>
    <textarea id="content" name="content" class="ckeditor"></textarea>
  </div>
  <input type="button" value="提交" class="btn btn-default" onclick="from1()"/>

</form>
  </tbody>
  </table>
  <script type="text/javascript">
function from1(){
	 var str=document.getElementsByName("box");
	 var objarray=str.length;
	 var chestr="";
	 for (i=0;i<objarray;i++)
	 {
	   if(str[i].checked == true)
	   {
	    chestr+=str[i].value;
	   }
	 }
	 if(chestr=="")
	 {
	   alert("请先选择是否通过！");
	 }
	 var  id = $("#gongwenid").val();
	 var options=chestr; 
	 var content =CKEDITOR.instances.content.getData();
	 $.post("gongwen/instructions",{id:id,content:content,options:options,},
	 function(data,status){
	 if("success"==data){
		 alert("提交成功！")
		 window.location.href="gongwen/lookgw";
	 }else{
	 alert("提交失败！");
	 }
	 });
	}
</script>
</body>
</html>